using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
using SalesPages.DomainModel;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class FranchiseMap : EntityTypeConfiguration<Franchise>
    {
        public FranchiseMap()
        {
            // Primary Key
            this.HasKey(t => t.FranchiseId);

            // Properties
            this.Property(t => t.Type)
                .HasMaxLength(50);

            this.Property(t => t.FirstName)
                .HasMaxLength(150);

            this.Property(t => t.LastName)
                .HasMaxLength(150);

            this.Property(t => t.HomeTel)
                .HasMaxLength(50);

            this.Property(t => t.Email)
                .HasMaxLength(150);

            this.Property(t => t.City)
                .HasMaxLength(150);

            this.Property(t => t.PostalCode)
                .HasMaxLength(50);

            this.Property(t => t.Country)
                .HasMaxLength(100);

            this.Property(t => t.HowHeardE1)
                .HasMaxLength(150);

            this.Property(t => t.CountryOpenSchool)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Franchise");
            this.Property(t => t.FranchiseId).HasColumnName("FranchiseId");
            this.Property(t => t.Type).HasColumnName("Type");
            this.Property(t => t.FirstName).HasColumnName("FirstName");
            this.Property(t => t.LastName).HasColumnName("LastName");
            this.Property(t => t.HomeTel).HasColumnName("HomeTel");
            this.Property(t => t.Email).HasColumnName("Email");
            this.Property(t => t.City).HasColumnName("City");
            this.Property(t => t.PostalCode).HasColumnName("PostalCode");
            this.Property(t => t.Country).HasColumnName("Country");
            this.Property(t => t.HowHeardE1).HasColumnName("HowHeardE1");
            this.Property(t => t.CountryOpenSchool).HasColumnName("CountryOpenSchool");
            this.Property(t => t.BackgroundEducation).HasColumnName("BackgroundEducation");
            this.Property(t => t.BackgroundBusiness).HasColumnName("BackgroundBusiness");
            this.Property(t => t.OwnOtherBusiness).HasColumnName("OwnOtherBusiness");
            this.Property(t => t.LookedOtherFranchise).HasColumnName("LookedOtherFranchise");
            this.Property(t => t.DateSubmitted).HasColumnName("DateSubmitted");
        }
    }
}
